package cn.itsource.feign.fallback;

import cn.itsource.domain.Login;
import cn.itsource.dto.LoginMealDto;
import cn.itsource.feign.client.LoginFeignClient;
import cn.itsource.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * <p>描述</p>
 *
 * @author 波波老师(微信 ： javabobo0513)
 * @date 2022/11/9-15:18
 */
@Component
public class LoginFeignClientFallback implements FallbackFactory<LoginFeignClient> {

    @Override
    public LoginFeignClient create(Throwable throwable) {
        return new LoginFeignClient(){
            @Override
            public JSONResult save(Login login) {
                throwable.printStackTrace();
                return JSONResult.error("数据保存到t_login表失败，请联系土皮老师.....");
            }

            @Override
            public JSONResult saveLoginMeal(LoginMealDto dto) {
                throwable.printStackTrace();
                return JSONResult.error("数据保存到t_login_meal表失败，请联系土皮老师.....");
            }
        };
    }
}